#include <iostream>
#include <string>
#include "UI.h"

using namespace std;

int menuPrincipal(void){
	int resposta;

	cout << "=====================" << endl;
	cout << "===== BENVINGUT =====" << endl;
	cout << "=====================" << endl;
	cout << "1. Habitacions" << endl;
	cout << "2. Reserves" << endl;
	cout << "3. Sortir" << endl;
	cout << "Tria una opció: ";
	cin >> resposta;

	return resposta;
}

int menuHabitacions(void){
	int resposta;

	cout << "============================" << endl;
	cout << "===== MENU HABITACIONS =====" << endl;
	cout << "============================" << endl;
	cout << "1. Afegir una Habitació" << endl;
	cout << "2. Llistar Habitacions" << endl;
	cout << "Tria una opció: ";
	cin >> resposta;

	return resposta;
}

int menuReserves(void){
	int resposta;

	cout << "=========================" << endl;
	cout << "===== MENU RESERVES =====" << endl;
	cout << "=========================" << endl;
	cout << "1. Realitzar una reserva" << endl;
	cout << "2. Comprobar una reserva" << endl;
	cout << "Tria una opció: ";
	cin >> resposta;

	return resposta;
}

t_habitacio demanarDadesHabitacio(void){
	t_habitacio h;
	string resposta;

	cout << "Numero d'habitacio: ";
	cin >> h.numHabitacio;
	cout << "Numero de planta: ";
	cin >> h.numPlanta;
	cout << "Numero de places: ";
	cin >> h.numPlaces;
	cout << "Te bany? [Si/No] ";
	cin >> resposta;
	// h.teBany = resposta == "Si"; <-- (per suprimir el if true/false)
	if(resposta == "Si"){
		h.teBany = true;
	}else{
		h.teBany = false;
	}

	return h;
}

void mostrarDadesHabitacio(t_habitacio h){
	cout << "Numero d'habitacio: " << h.numHabitacio << endl;
	cout << "Numero de planta: " << h.numPlanta << endl;
	cout << "Numero de places: " << h.numPlaces << endl;
	//cout << "Te bany: " << ((h.teBany?)"Si":"No") << endl;
	if(h.teBany == true){
		cout << "L'habitacio disposa de bany" << endl;
	}else{
		cout << "Aquesta habitacio no te bany" << endl;
	}
}

t_ui_demana_reserva uiDemanaDadesFerReserva(void){
		t_ui_demana_reserva r;
		string s_n;
		cout << "** RESERVES: Fer reserva" << endl;
		cout << "Digues el teu nom:";
		cin >> r.aNomDe;
		cout << "Quantes persones seran?";
		cin >> r.nPlaces;
		cout << "Volen bany (s/n)?";
		cin >> s_n;
		r.volBany = s_n == "S";
		cout << "Data Inici:";
		cin >> r.dataInici;
		cout << "Data fi:";
		cin >> r.dataFi;

		return r;
}
t_ui_comproba_reserva uiDemanaDadesComprobaReserva(void){
	t_ui_comproba_reserva r;
	string s_n;
	cout << "** RESERVES: Comprova reserva" << endl;
	cout << "Digues el teu nom:";
	cin >> r.aNomDe;
	cout << "Data Inici:";
	cin >> r.dataInici;

	return r;
}
void MostraDadesReserva(t_reserva r){
	cout << "**Reserves **"<< endl;
	cout << "Nom: "<< r.aNomDe << endl;
	cout << "Data inici:" << r.dataInici<< endl;
	cout << "Data fi:   " << r.dataFi << endl;
	cout << "Habitació:"  << r.habitacioAsignada<< endl;
	cout << "n Persones:" << r.numPersones << endl;
}


void mostraMissatgeOK(void) {
	cout << "Operació realitzada correctament" <<endl;
}
void mostraMissatgeKO(void) {
	cout << "Errors realutzant la Operació" <<endl;
}
